const nodemailer=require('nodemailer');
const config=require('./config');
module.exports=function sendMail(to,code){
    let smtpTransport = nodemailer.createTransport({
        host: config.smtp_host,
        port: config.smtp_port,
        secure: config.isSSL,
        auth: {
            user: config.smtp_user,
            pass: config.smtp_pass
        }
    });
    smtpTransport.sendMail({
        from: `"${config.fromName}" <${config.smtp_user}>`,
        to: to,
        subject: "绑定邮箱验证",
        text: `你好！感谢你使用熊猫商城，你的绑定邮箱验证码为：${code}`,
    },function(err){
        if(!err){
            console.log('Send Success');
        }else{
            console.log('Send Faild :'+err);
        }
    });
}